package com.yycwxt.modules.admin.store;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yycwxt.domain.Store;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface StoreMapper extends BaseMapper<Store> { // mybatis-plus 继承BaseMapper<Store>
    @Select("select * from glb_store;")
    List<Store> selectAll();

    @Select("select * from glb_store where id like concat('%',#{input},'%') or code like concat('%',#{input},'%') or " +
            "pinyin like concat('%',#{input},'%') or name like concat('%',#{input},'%') or " +
            "fullname like concat('%',#{input},'%') or city like concat('%',#{input},'%') or address like concat('%',#{input},'%');")
    List<Store> selectByInput(@Param("input") String input);

    @SelectProvider(type = MySelectProvider.class,method = "mohu")
    List<Store> selectByInput2(Map<String, Object> map);

    ////使用mybatis-plus 就删除这段代码
    @Insert("INSERT INTO glb_store(name, city, address, remark) VALUES (#{name}, #{city}, #{address}, #{remark})")
     int add(Store store);

    // 持久层主要功能： 添加，根据主键删除，更新，根据id查询，查询全部
}
